﻿using System;

namespace Dyao.Book.Contract.Serialization
{
    /// <summary>
    /// 标记在Json转换中，值为null的属性或字段会转换为Empty值。
    /// </summary>
    [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
    public class ConvertNullToEmptyAttribute : Attribute
    {
        public bool IsConvetNullToEmpty { get; set; } = true;

        public ConvertNullToEmptyAttribute() { }

        public ConvertNullToEmptyAttribute(bool isConvertNullToEmpty)
        {
            this.IsConvetNullToEmpty = isConvertNullToEmpty;
        }
    }
}
